// $codepro.audit.disable numericLiterals
/**
 * Class: PATIENT INVOICE PANEL
 * Description: 
 * 
 * @author Team Awesome Express
 * @version $ Revision 1.0 $
 * 
 */
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JLabel;


/**
 * @author Team Awesome Express
 * @version 1.0
 */
public class PatientInvoicePanel extends JPanel {
	/**
	 * Field txtPatientName.
	 */
	private final JTextField txtPatientName;

	/**
	 * Field txtDate.
	 */
	private final JTextField txtDate;

	/**
	 * Field txtTreatDoctor.
	 */
	private final JTextField txtTreatDoctor;

	/**
	 * Field txtBillable.
	 */
	private final JTextArea txtBillable;

	/**
	 * Field myDataManager.
	 */
	private DataManager myDataManager;

	/**
	 * Field frame.
	 */
	private static JFrame Frame;

	/**
	 * Create the panel.
	 * @param myDataManager DataManager
	 * @param patientInv PatientInvoice
	 */
	public PatientInvoicePanel(DataManager myDataManager, PatientInvoice patientInv) {
		setBackground(GlobalVars.BACKGROUND);
		this.myDataManager = myDataManager;
		setLayout(null);
		txtPatientName = new JTextField();
		txtPatientName.setBounds(87, 30, 86, 20);
		add(txtPatientName);
		txtPatientName.setColumns(10);
		
		txtDate = new JTextField();
		txtDate.setBounds(87, 76, 86, 20);
		add(txtDate);
		txtDate.setColumns(10);

		txtTreatDoctor = new JTextField();
		txtTreatDoctor.setBounds(87, 129, 86, 20);
		add(txtTreatDoctor);
		txtTreatDoctor.setColumns(10);
		
		txtBillable = new JTextArea();
		txtBillable.setBounds(87, 174, 294, 169);
		add(txtBillable);
		txtBillable.setColumns(10);
		txtBillable.setText(patientInv.populateItemizedList());
		
		final JLabel lblName = new JLabel("Name :");
		lblName.setBounds(10, 33, 46, 14);
		add(lblName);
		
		final JLabel lblDate = new JLabel("Date :");
		lblDate.setBounds(10, 79, 46, 14);
		add(lblDate);
		
		final JLabel lblTreatingDoctor = new JLabel("Doctor :");
		lblTreatingDoctor.setBounds(10, 132, 46, 14);
		add(lblTreatingDoctor);
		
		final JLabel lblItemizedBill = new JLabel("Itemized Bill :");
		lblItemizedBill.setBounds(0, 218, 77, 14);
		add(lblItemizedBill);
		
		txtPatientName.setText(patientInv.getName());
		txtDate.setText(patientInv.getDate());
		txtTreatDoctor.setText(patientInv.getDoctor());
		
		if(myDataManager.getUserType() == GlobalVars.PATIENT_USERTYPE){
			txtPatientName.setEnabled(false);
			txtDate.setEnabled(false);
			txtTreatDoctor.setEnabled(false);
			txtBillable.setEnabled(false);
		}
	}
	
	/**
	 * Method createWindow.
	 * @param myDataManager DataManager
	 * @param patientInv PatientInvoice
	 * @return JFrame
	 */
	public static JFrame createWindow(DataManager myDataManager, PatientInvoice patientInv) {
		Frame = new JFrame();
		Frame.setSize(500, 425);
		Frame.getContentPane().add(new PatientInvoicePanel(myDataManager, patientInv));
		Frame.setVisible(true);
		Frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		return Frame;
		}
}
